package com.mindmax.user.service.impl;

import java.util.List;

import com.mindmax.user.domain.TenantResource;
import com.mindmax.user.mapper.TenantResourceMapper;
import com.mindmax.user.service.ITenantResourceService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 租户权限关系Service业务层处理
 * 
 * @author cab
 * @date 2024-04-23
 */
@Service
public class TenantResourceServiceImpl implements ITenantResourceService
{
    @Autowired
    private TenantResourceMapper tenantResourceMapper;

    /**
     * 查询租户权限关系
     * 
     * @param id 租户权限关系主键
     * @return 租户权限关系
     */
    @Override
    public TenantResource selectTenantResourceById(Long id)
    {
        return tenantResourceMapper.selectTenantResourceById(id);
    }

    /**
     * 查询租户权限关系列表
     * 
     * @param tenantResource 租户权限关系
     * @return 租户权限关系
     */
    @Override
    public List<TenantResource> selectTenantResourceList(TenantResource tenantResource)
    {
        return tenantResourceMapper.selectTenantResourceList(tenantResource);
    }

    /**
     * 新增租户权限关系
     * 
     * @param tenantResource 租户权限关系
     * @return 结果
     */
    @Override
    public int insertTenantResource(TenantResource tenantResource)
    {
        tenantResource.setCreateTime(DateUtils.getNowDate());
        return tenantResourceMapper.insertTenantResource(tenantResource);
    }

    /**
     * 修改租户权限关系
     * 
     * @param tenantResource 租户权限关系
     * @return 结果
     */
    @Override
    public int updateTenantResource(TenantResource tenantResource)
    {
        return tenantResourceMapper.updateTenantResource(tenantResource);
    }

    /**
     * 批量删除租户权限关系
     * 
     * @param ids 需要删除的租户权限关系主键
     * @return 结果
     */
    @Override
    public int deleteTenantResourceByIds(Long[] ids)
    {
        return tenantResourceMapper.deleteTenantResourceByIds(ids);
    }

    /**
     * 删除租户权限关系信息
     * 
     * @param id 租户权限关系主键
     * @return 结果
     */
    @Override
    public int deleteTenantResourceById(Long id)
    {
        return tenantResourceMapper.deleteTenantResourceById(id);
    }

    @Override
    public void deleteTenantResourceByTenantId(Long tenantId) {
        tenantResourceMapper.deleteTenantResourceByTenantId(tenantId);
    }
}
